using System;
using System.Windows.Forms;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using mvLibrary;
using mvLibrary.Controls;
using System.ComponentModel;
using BlueFinity.mvNET;

namespace mvLibrary.Controls
{
    /// <summary>
    /// Implementa un control DataGridViewTextBoxColumn tipo Label para pick
    /// </summary>
    public class mvLabelColumn : DataGridViewTextBoxColumn
    {
        public mvLabelColumn() : base()
        {
            ReadOnly = true;
        }

        public override DataGridViewCell CellTemplate
        {

            get
            {
                return base.CellTemplate;
            }
            set
            {

                base.CellTemplate = value;
            }
        }
        #region Campos
        private int _attribute;
        private string _regularExpression = string.Empty;
        public string _mask;
        private mvTextBox.TextMask _maskType = mvTextBox.TextMask.None;
        #endregion
        #region Propiedades (Se deben incluir en el metodo Clone()  )
        [Category("Multivalue")]
        public int Attribute
        {
            get { return _attribute; }
            set { _attribute = value; }
        }
        [Category("Multivalue")]
        public string RegularExpression
        {
            get { return _regularExpression; }
            set { _regularExpression = value; }
        }
        
        [Category("Multivalue")]
        public mvTextBox.TextMask MaskType
        {
            get { return _maskType; }
            set
            {
                _maskType = value;
                switch (_maskType)
                {
                    case mvTextBox.TextMask.DateShort:
                        _mask = "D2/";
                        break;
                    case mvTextBox.TextMask.DateLong:
                        _mask = "D4/";
                        break;
                    case mvTextBox.TextMask.Decimal:
                        _mask = "MD2";
                        break;
                    case mvTextBox.TextMask.Integer:
                        _mask = "MD0";
                        break;
                    case mvTextBox.TextMask.TimeLong:
                        _mask = "MTS";
                        break;
                    case mvTextBox.TextMask.TimeShort:
                        _mask = "MTD";
                        break;
                    case mvTextBox.TextMask.Decimal3:
                        _mask = "MR3";
                        break;
                    case mvTextBox.TextMask.Decimal4:
                        _mask = "MR4";
                        break;
                    case mvTextBox.TextMask.Decimal5:
                        _mask = "MR5";
                        break;
                    case mvTextBox.TextMask.Decimal6:
                        _mask = "MR6";
                        break;
                    default:
                        _mask = "";
                        break;
                }
            }
        }
        #endregion propiedades
        public override object Clone()
        {
            mvLabelColumn BaseCol = base.Clone() as mvLabelColumn;
            BaseCol.Attribute = _attribute;
            BaseCol.RegularExpression = _regularExpression;
            BaseCol.MaskType = _maskType;
            return BaseCol;
        }
    }
}
